package site.marqstree.latte.ec.main.personal.list;

/*
 * 项目名: EleCommerce
 * 包名: site.marqstree.latte.ec.main.personal.list
 * 文件名: ListBean
 * 创建者: marqstree
 * 创建时间: 2020/2/3 16:21
 * 描述: TODO
 */

import com.chad.library.adapter.base.entity.MultiItemEntity;

import site.marqstree.latte.core.delegates.LatteDelegate;

public class ListBean implements MultiItemEntity {

    private int mItemType = 0;
    private String mImageUrl = null;
    private String mText = null;
    private String mValue = null;
    private int mId = 0;
    private LatteDelegate mDelegate = null;

    public ListBean(int mItemType, String mImageUrl, String mText, String mValue, int mId,
                LatteDelegate mDelegate) {
        this.mItemType = mItemType;
        this.mImageUrl = mImageUrl;
        this.mText = mText;
        this.mValue = mValue;
        this.mId = mId;
        this.mDelegate = mDelegate;
    }

    public String getImageUrl() {
        return mImageUrl;
    }

    public String getText() {
        if (mText == null) {
            return "";
        }
        return mText;
    }

    public String getValue() {
        if (mValue == null) {
            return "";
        }
        return mValue;
    }

    public int getId() {
        return mId;
    }

    @Override
    public int getItemType() {
        return mItemType;
    }

    public LatteDelegate getDelegate() {
        return this.mDelegate;
    }

    public static final class Builder {

        private int id = 0;
        private int itemType = 0;
        private String imageUrl = null;
        private String text = null;
        private String value = null;
        private LatteDelegate delegate = null;

        public Builder setId(int id) {
            this.id = id;
            return this;
        }

        public Builder setItemType(int itemType) {
            this.itemType = itemType;
            return this;
        }

        public Builder setImageUrl(String imageUrl) {
            this.imageUrl = imageUrl;
            return this;
        }

        public Builder setText(String text) {
            this.text = text;
            return this;
        }

        public Builder setValue(String value) {
            this.value = value;
            return this;
        }

        public Builder setDelegate(LatteDelegate delegate) {
            this.delegate = delegate;
            return this;
        }

        public ListBean build() {
            return new ListBean(itemType, imageUrl, text, value, id, delegate);
        }
    }
}